<?php
class TimelineModel extends Model{
    static private $_C=array(
        'TYPE_WISH' =>  1,
        'TYPE_TAKE'=>  2,
        'TYPE_EVENT'=>  3,
        'TYPE_TOPIC'=>  4,
        'TYPE_REPLY'=>  5,
    );
    static private $_L=null;    /*=array(
        'TYPE_NAME'=> null,
    );*/
    static public function C($name){
        return self::$_C[$name];
    }
    static public function L($name, $index=null){
        if (is_null($index)){
            return self::$_L[$name];
        } else{
            return self::$_L[$name][$index];
        }
    }
    /****
    * 获得TL操作的名称
    * @type 应当为type对应id
    */
    static public function LTypeName($type){
        $t= L('TIMELINE_TYPE');
        return $t[$type];
    }
    
    /* not used yet
    public function TimelineModel(){
        parent::__Cruct();
        if (is_null(self::$_L)){
        //重置用语参数
            $t= L('TIMELINE_TYPE');
        }
    }*/
    static public function factor($type, $uid, $aid, $text='', $xid=0){
        if (! array_key_exists($type, self::$_C)){
            return null;
        }
        $data= array(
            'uid'=> $uid,
            'type'=>self::C($type),
            'aid'=>$aid,
            'xid'=> $xid,
            'text'=>$text,
        );
        $TM= new TimelineModel();
        return $TM->data($data);
    }
    protected function X_after_select(&$resultSet,$options) {
        foreach($resultSet as &$result){
            $this->_after_find($result, $options);
        }
        return true;
    }
    protected function X_after_find(&$result,$options) {
        //switch($result['type']);

        return true;
    }
}
?>